<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Navo Portable Library: navo/algorithm/linear/linked/sclnk.c源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- 制作者 Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Navo Portable Library&#160;<span id="projectnumber">Ver 1.0.20120827</span></div>
   <div id="projectbrief">Provides generic platform independent facilities.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>数据结构</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>全局定义</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>navo/algorithm/linear/linked/sclnk.c</h1>  </div>
</div>
<div class="contents">
<a href="sclnk_8c.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &quot;<a class="code" href="sclnk_8h.html" title="Singly circular linked list.">sclnk.h</a>&quot;</span>
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#pragma optimize(&quot;t&quot;, on)</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span><span class="preprocessor">#endif  </span><span class="comment">/* #ifdef _MSC_VER */</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00019"></a>00019 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l00020"></a>00020 
<a name="l00021"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga872679837eaeacd2383f86cdbfa3e406">00021</a> NV_IMPL <span class="keywordtype">int</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga872679837eaeacd2383f86cdbfa3e406" title="判断链表结构是否正常">sclnk_check</a>(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_head</a>* head, <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a>* loop_entry)
<a name="l00022"></a>00022 {
<a name="l00023"></a>00023     <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> slow = head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00024"></a>00024     <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> fast = slow;
<a name="l00025"></a>00025     
<a name="l00026"></a>00026     <span class="keywordflow">while</span> (fast != head &amp;&amp; fast-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> != head) {
<a name="l00027"></a>00027         <span class="keywordflow">if</span> (!fast || !fast-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>)
<a name="l00028"></a>00028             <span class="keywordflow">return</span> SCLNK_CHECK_NULL;
<a name="l00029"></a>00029         slow = slow-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00030"></a>00030         fast = fast-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00031"></a>00031         <span class="keywordflow">if</span> (fast == slow) {
<a name="l00032"></a>00032             <span class="keywordflow">if</span> (loop_entry) {
<a name="l00033"></a>00033                 <span class="comment">/* 获取环路入口 */</span>
<a name="l00034"></a>00034                 slow = head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00035"></a>00035                 <span class="keywordflow">while</span> (fast != slow) {
<a name="l00036"></a>00036                     slow = slow-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00037"></a>00037                     fast = fast-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00038"></a>00038                 }
<a name="l00039"></a>00039                 *loop_entry = slow;
<a name="l00040"></a>00040             }
<a name="l00041"></a>00041             <span class="keywordflow">return</span> SCLNK_CHECK_LOOP;
<a name="l00042"></a>00042         }
<a name="l00043"></a>00043     }
<a name="l00044"></a>00044     
<a name="l00045"></a>00045     <span class="keywordflow">return</span> SCLNK_CHECK_PASS;
<a name="l00046"></a>00046 }
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 NV_IMPL <span class="keywordtype">void</span> __sclnk_iter_swap(
<a name="l00049"></a>00049     <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> aprev, <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> a, <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> anext, 
<a name="l00050"></a>00050     <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> bprev, <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> b, <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> bnext)
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052     <span class="keywordflow">if</span> (a == bprev) {
<a name="l00053"></a>00053         <span class="comment">/* (1) b节点是a节点的后继节点</span>
<a name="l00054"></a>00054 <span class="comment">         *                               (a)</span>
<a name="l00055"></a>00055 <span class="comment">         * -(ap)-(a)-(b)-(bn)- ===&gt;                ===&gt; -(ap)-(b)-(a)-(bn)-</span>
<a name="l00056"></a>00056 <span class="comment">         *                          -(ap)-(b)-(bn)-</span>
<a name="l00057"></a>00057 <span class="comment">         */</span>
<a name="l00058"></a>00058         aprev-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = b;
<a name="l00059"></a>00059         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga77475af7dbf05e051e3c9ca17b7b9603" title="在两个节点之间插入一个新节点">sclnk_insert_between</a>(a, b, bnext);
<a name="l00060"></a>00060     }
<a name="l00061"></a>00061     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (a == bnext) {
<a name="l00062"></a>00062         <span class="comment">/* (2) a节点是b节点的后继节点</span>
<a name="l00063"></a>00063 <span class="comment">         *                               (b)</span>
<a name="l00064"></a>00064 <span class="comment">         * -(bp)-(b)-(a)-(an)- ===&gt;                ===&gt; -(bp)-(a)-(b)-(an)-</span>
<a name="l00065"></a>00065 <span class="comment">         *                          -(bp)-(a)-(an)-</span>
<a name="l00066"></a>00066 <span class="comment">         */</span>
<a name="l00067"></a>00067         bprev-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = a;
<a name="l00068"></a>00068         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga77475af7dbf05e051e3c9ca17b7b9603" title="在两个节点之间插入一个新节点">sclnk_insert_between</a>(b, a, anext);
<a name="l00069"></a>00069     }
<a name="l00070"></a>00070     <span class="keywordflow">else</span> {
<a name="l00071"></a>00071         <span class="comment">/* (3) a节点、b节点不相邻 </span>
<a name="l00072"></a>00072 <span class="comment">         * -(ap)-(a)-(an)-...-(bp)-(b)-(bn)- ===&gt; </span>
<a name="l00073"></a>00073 <span class="comment">         *                                              (a)</span>
<a name="l00074"></a>00074 <span class="comment">         *                                        -(ap)-(b)-(an)-...-(bp) (bn)-</span>
<a name="l00075"></a>00075 <span class="comment">         *</span>
<a name="l00076"></a>00076 <span class="comment">         *  --(ap)-(b)-(an)-...-(bp)-(a)-(bn)-- &lt;===</span>
<a name="l00077"></a>00077 <span class="comment">         */</span>
<a name="l00078"></a>00078         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga77475af7dbf05e051e3c9ca17b7b9603" title="在两个节点之间插入一个新节点">sclnk_insert_between</a>(b, aprev, anext);
<a name="l00079"></a>00079         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga77475af7dbf05e051e3c9ca17b7b9603" title="在两个节点之间插入一个新节点">sclnk_insert_between</a>(a, bprev, bnext);
<a name="l00080"></a>00080     }
<a name="l00081"></a>00081 }
<a name="l00082"></a>00082 
<a name="l00083"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0d3b25cd83d8ae088a5a052be9a19c90">00083</a> NV_IMPL <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0d3b25cd83d8ae088a5a052be9a19c90" title="计算两个节点的迭代距离">sclnk_distance</a>(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> first, <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> last)
<a name="l00084"></a>00084 {
<a name="l00085"></a>00085     <span class="keywordtype">size_t</span> dist = 1;
<a name="l00086"></a>00086     
<a name="l00087"></a>00087     <span class="keywordflow">while</span> (first != last) {
<a name="l00088"></a>00088         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3c63ec804c220dc76dc32687212c2bb9" title="迭代器递增">sclnk_inc</a>(first);
<a name="l00089"></a>00089         ++dist;
<a name="l00090"></a>00090     }
<a name="l00091"></a>00091     
<a name="l00092"></a>00092     <span class="keywordflow">return</span> dist;
<a name="l00093"></a>00093 }
<a name="l00094"></a>00094 
<a name="l00095"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4c2368c8b739c616e4a31cdb70e0f109">00095</a> NV_IMPL <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4c2368c8b739c616e4a31cdb70e0f109" title="统计表的节点数量">sclnk_count</a>(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_head</a>* head)
<a name="l00096"></a>00096 {
<a name="l00097"></a>00097     <span class="keywordtype">size_t</span> cnt = 0;
<a name="l00098"></a>00098     <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> i = head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00099"></a>00099 
<a name="l00100"></a>00100     <span class="keywordflow">while</span> (i != head) {
<a name="l00101"></a>00101         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3c63ec804c220dc76dc32687212c2bb9" title="迭代器递增">sclnk_inc</a>(i);
<a name="l00102"></a>00102         ++cnt;
<a name="l00103"></a>00103     }
<a name="l00104"></a>00104 
<a name="l00105"></a>00105     <span class="keywordflow">return</span> cnt;
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107 
<a name="l00108"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga29a3829d5949bdecbc4d9911d0136c75">00108</a> NV_IMPL <span class="keywordtype">void</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga29a3829d5949bdecbc4d9911d0136c75" title="反转表">sclnk_reverse</a>(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_head</a>* head)
<a name="l00109"></a>00109 {
<a name="l00110"></a>00110     <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> i = <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga33ab0148a458bbc3a45d9ab58b3af75b" title="得到用于反转的起始位置的迭代器">sclnk_vbegin</a>(head);
<a name="l00111"></a>00111     <span class="keywordflow">while</span> (i != <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga7c89eff8cd82862599fea6c9eb460836" title="得到用于反转的终止位置的迭代器">sclnk_vend</a>(head))
<a name="l00112"></a>00112         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaa2764d0d3c341ee6915de4c6e50c4081" title="入栈反转">sclnk_vpush</a>(head, i);
<a name="l00113"></a>00113 }
<a name="l00114"></a>00114 
<a name="l00115"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4f486152712faaff0fd27a48f3ea3e50">00115</a> NV_IMPL <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga4f486152712faaff0fd27a48f3ea3e50" title="给迭代器增加一段距离或减小一段距离">sclnk_advance</a>(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_head</a>* head, <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> cur, <span class="keywordtype">size_t</span> dist)
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117     <span class="keywordflow">while</span> (cur != head &amp;&amp; dist--)
<a name="l00118"></a>00118         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3c63ec804c220dc76dc32687212c2bb9" title="迭代器递增">sclnk_inc</a>(cur);
<a name="l00119"></a>00119     
<a name="l00120"></a>00120     <span class="keywordflow">return</span> cur;
<a name="l00121"></a>00121 }
<a name="l00122"></a>00122 
<a name="l00123"></a><a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaba18db2b0803f2dc314109f95266e92a">00123</a> NV_IMPL <span class="keywordtype">size_t</span> <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaba18db2b0803f2dc314109f95266e92a" title="计算迭代器的正向索引">sclnk_index_of</a>(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_head</a>* head, <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> itr)
<a name="l00124"></a>00124 {
<a name="l00125"></a>00125     <span class="keywordtype">size_t</span> cnt = 0;
<a name="l00126"></a>00126     <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> i = head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00127"></a>00127     
<a name="l00128"></a>00128     <span class="keywordflow">while</span> (i != head &amp;&amp; i != itr) {
<a name="l00129"></a>00129         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga3c63ec804c220dc76dc32687212c2bb9" title="迭代器递增">sclnk_inc</a>(i);
<a name="l00130"></a>00130         ++cnt;
<a name="l00131"></a>00131     }
<a name="l00132"></a>00132     
<a name="l00133"></a>00133     <span class="keywordflow">return</span> cnt;
<a name="l00134"></a>00134 }
<a name="l00135"></a>00135 
<a name="l00136"></a>00136 NV_IMPL <span class="keywordtype">void</span> __sclnk_serialize(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_head</a>* head, <span class="keywordtype">char</span>** buf, 
<a name="l00137"></a>00137                                 <span class="keyword">const</span> <span class="keywordtype">size_t</span> offset)
<a name="l00138"></a>00138 {
<a name="l00139"></a>00139     <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> i = head-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00140"></a>00140     <span class="keywordflow">while</span> (i != head) {
<a name="l00141"></a>00141         *buf++ = ((<span class="keywordtype">char</span>*)i) - offset;
<a name="l00142"></a>00142         i = i-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a>;
<a name="l00143"></a>00143     }
<a name="l00144"></a>00144 }
<a name="l00145"></a>00145 
<a name="l00146"></a>00146 NV_IMPL <span class="keywordtype">void</span> __sclnk_deserialize(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_head</a>* head, <span class="keywordtype">char</span>** buf, 
<a name="l00147"></a>00147                                 <span class="keywordtype">size_t</span> cnt, <span class="keyword">const</span> <span class="keywordtype">size_t</span> offset)
<a name="l00148"></a>00148 {
<a name="l00149"></a>00149     <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> t, p = head;
<a name="l00150"></a>00150 
<a name="l00151"></a>00151     <span class="keywordflow">if</span> (!cnt)
<a name="l00152"></a>00152         <span class="keywordflow">return</span>;
<a name="l00153"></a>00153     <span class="keywordflow">while</span> (cnt--) {
<a name="l00154"></a>00154         t = (<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gac57396cc7f5239b52d30d83fb3d0fd45" title="迭代器">sclnk_iter</a>)(*buf++ + offset);
<a name="l00155"></a>00155         p-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = t;
<a name="l00156"></a>00156         p = t;
<a name="l00157"></a>00157     }
<a name="l00158"></a>00158     t-&gt;<a class="code" href="struct____sclnk__node.html#a000a5cc174c66223aacee1b9c6bb90b2" title="后继节点">next</a> = head;
<a name="l00159"></a>00159 }
<a name="l00160"></a>00160 
<a name="l00161"></a>00161 NV_IMPL <span class="keywordtype">void</span> __sclnk_free(<a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> begin, <a class="code" href="struct____sclnk__node.html" title="单向环形链表节点">sclnk_iter</a> end, 
<a name="l00162"></a>00162                         <a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#gaf2a36f248bc34b1d960ff647cc806270" title="单参数回调函数指针">sclnk_pr1</a> erase_handler)
<a name="l00163"></a>00163 {
<a name="l00164"></a>00164     <span class="keywordflow">while</span> (begin != end)
<a name="l00165"></a>00165         erase_handler(<a class="code" href="group___xE5_x8D_x95_xE5_x90_x91_xE7_x8E_xAF_xE5_xBD_xA2_xE9_x93_xBE_xE8_xA1_xA8.html#ga0ae905a556af3efe6a608b57a8ff9c94" title="迭代器后自增">sclnk_inc_later</a>(begin));
<a name="l00166"></a>00166 }
<a name="l00167"></a>00167 
<a name="l00168"></a>00168 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00169"></a>00169 <span class="preprocessor"></span>}
<a name="l00170"></a>00170 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l00171"></a>00171 
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>数据结构</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated at 2015年七月16日 星期四 12:00:37 for Navo Portable Library by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>
